package org.viva.service.secu;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.viva.core.dao.BaseDAO;
import org.viva.entity.secu.User;

@Service("userService")
public class UserService {

    @Resource
    private BaseDAO<User> dao;

    public User getUserByName(String username) {
        return dao.get("from User where code = ?", new String[] { username });
    }

    public List<String> loadUserAuthoritiesByName(String username) {
        return null;
    }

    public User getUserByQQOpenid(String openid) {
        try {
            return dao.get("from User where QQOpenid = ?", new String[] { openid });
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
